package com.nyist.controller;

import com.nyist.result.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ConsumerZKController {
    @Autowired
    RestTemplate restTemplate;

    private static String url="http://cloud-provider";

    @GetMapping(value = "/consumer/test/{name}")
    public CommonResult test(@PathVariable("name") String name) {
        System.out.println("进入消费者ZK：进行消费");
        return restTemplate.getForObject(url+"/provider/hello/"+name,CommonResult.class);
    }
}
